package br.ucb.cm.config.bean;

import java.io.Serializable;

public class Movimentation implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private boolean left;
	private boolean right;
	private boolean up;
	private boolean down;

	private boolean upLeft;
	private boolean upRight;
	private boolean downLeft;
	private boolean downRight;

	private boolean maxVertical;
	private boolean maxHorizontal;
	private boolean maxDiagonal;

	public Movimentation(boolean left, boolean right, boolean up, boolean down,
			boolean upLeft, boolean upRight, boolean downLeft,
			boolean downRight, boolean maxVertical, boolean maxHorizontal,
			boolean maxDiagonal) {
		this.left = left;
		this.right = right;
		this.up = up;
		this.down = down;
		this.upLeft = upLeft;
		this.upRight = upRight;
		this.downLeft = downLeft;
		this.downRight = downRight;
		this.maxVertical = maxVertical;
		this.maxHorizontal = maxHorizontal;
		this.maxDiagonal = maxDiagonal;
	}

	public boolean canLeft() {
		return left;
	}

	public void setLeft(boolean Left) {
		this.left = Left;
	}

	public boolean canRight() {
		return right;
	}

	public void setRight(boolean Right) {
		this.right = Right;
	}

	public boolean canUp() {
		return up;
	}

	public void setUp(boolean Up) {
		this.up = Up;
	}

	public boolean canDown() {
		return down;
	}

	public void setDown(boolean Down) {
		this.down = Down;
	}

	public boolean canUpLeft() {
		return upLeft;
	}

	public void setUpLeft(boolean UpLeft) {
		this.upLeft = UpLeft;
	}

	public boolean canUpRight() {
		return upRight;
	}

	public void setUpRight(boolean UpRight) {
		this.upRight = UpRight;
	}

	public boolean canDownLeft() {
		return downLeft;
	}

	public void setDownLeft(boolean DownLeft) {
		this.downLeft = DownLeft;
	}

	public boolean canDownRight() {
		return downRight;
	}

	public void setDownRight(boolean DownRight) {
		this.downRight = DownRight;
	}

	public boolean canMaxVertical() {
		return maxVertical;
	}

	public void setMaxVertical(boolean MaxVertical) {
		this.maxVertical = MaxVertical;
	}

	public boolean canMaxHorizontal() {
		return maxHorizontal;
	}

	public void setMaxHorizontal(boolean MaxHorizontal) {
		this.maxHorizontal = MaxHorizontal;
	}

	public boolean canMaxDiagonal() {
		return maxDiagonal;
	}

	public void setMaxDiagonal(boolean MaxDiagonal) {
		this.maxDiagonal = MaxDiagonal;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (down ? 1231 : 1237);
		result = prime * result + (downLeft ? 1231 : 1237);
		result = prime * result + (downRight ? 1231 : 1237);
		result = prime * result + (left ? 1231 : 1237);
		result = prime * result + (maxDiagonal ? 1231 : 1237);
		result = prime * result + (maxHorizontal ? 1231 : 1237);
		result = prime * result + (maxVertical ? 1231 : 1237);
		result = prime * result + (right ? 1231 : 1237);
		result = prime * result + (up ? 1231 : 1237);
		result = prime * result + (upLeft ? 1231 : 1237);
		result = prime * result + (upRight ? 1231 : 1237);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Movimentation other = (Movimentation) obj;
		if (down != other.down)
			return false;
		if (downLeft != other.downLeft)
			return false;
		if (downRight != other.downRight)
			return false;
		if (left != other.left)
			return false;
		if (maxDiagonal != other.maxDiagonal)
			return false;
		if (maxHorizontal != other.maxHorizontal)
			return false;
		if (maxVertical != other.maxVertical)
			return false;
		if (right != other.right)
			return false;
		if (up != other.up)
			return false;
		if (upLeft != other.upLeft)
			return false;
		if (upRight != other.upRight)
			return false;
		return true;
	}

	public boolean hasMove() {
		return canDown() || canDownLeft() || canDownRight() || canLeft()
				|| canMaxDiagonal() || canMaxHorizontal() || canMaxVertical()
				|| canRight() || canUp() || canUpLeft() || canUpRight();
	}

}
